import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn' // 引入中文语言包
import App from './App.vue'
import router from './router/index'
import axios from 'axios'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import pagination from '@/components/pagination.vue'
import SearchContent from '@/components/SearchContent.vue'
import SortableTable from '@/components/SortableTable.vue'



import '@/assets/font/iconfont.css' //iconfont的样式
import '@/style/init.css' //初始化css
import '@/style/global.css' //初始化css
import '@/style/theme.less'

import store from './store/index'

import moment from 'moment'

const app = createApp(App)


// 注册全局组件
app.component('pagination', pagination);
app.component('SearchContent', SearchContent);
app.component('SortableTable', SortableTable);


app.config.globalProperties.$axios = axios
app.config.globalProperties.moment = moment

app.config.globalProperties.version = (window as any).baseURL.VERSION
app.config.globalProperties.uploadURL = (window as any).baseURL.SERVICE_CONTEXT_PATH
axios.defaults.baseURL = (window as any).baseURL.SERVICE_CONTEXT_PATH // ip配置文件引入


app.use(router)
app.use(store)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(ElementPlus, {
  locale: zhCn, // 设置全局语言为中文
})
app.mount('#app')